﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucThemTinTuc.ascx.cs"
    Inherits="STT.Admin.UserControls.ucThemTinTuc" %>

<div id="content-header">
    <div id="breadcrumb">
        <a href="../Admin/Default.aspx?idpage=1" class="tip-bottom" data-original-title="Về bảng điều khiển">
            <i class="icon-home"></i>Trang chính
        </a>
        <a href="../Admin/Default.aspx?idpage=qltt" class="current">Quản lý tin tức</a>
        <a href="#" class="current">Thêm tin tức </a>
    </div>
</div>
<div class="widget-box collapsible">
    <div class="widget-title">
        <a href="#collapseOne" data-toggle="collapse" class="">
            <span class="icon"><i class="icon-th"></i></span>
            <h5>Nhập thông tin</h5>
        </a>
    </div>
    <div class="in collapse" id="collapseOne" style="height: auto;">
        <div class="widget-content nopadding">
            <div class="dataTables_wrapper" role="grid">
                <%-- Cac dieu kien tim kiem --%>
                <div class="container-fluid">
                    <div class="row-fluid">
                        <div class="control-group">
                            <label class="control-label">Tiêu đề: </label>
                            <div class="controls">
                                <asp:TextBox ID="txtTieuDeTT" runat="server" class="span20"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" ValidationExpression="^[\s\S]{0,3}$"
                                    ToolTip="Bạn chưa nhập tiêu đề" ForeColor="Red" Font-Bold="true" ControlToValidate="txtTieuDeTT"
                                    runat="server" ErrorMessage="(*)" ValidationGroup="tm"></asp:RequiredFieldValidator>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">Tóm tắt: </label>
                            <div class="controls">
                                <asp:TextBox ID="txtTomTat" runat="server" class="span20" TextMode="MultiLine" Rows="3"></asp:TextBox>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">Ảnh đại diện: </label>
                            <div class="controls">
                                <asp:Image ID="anhDaiDien" runat="server" Width="120px" ImageUrl="~/Uploads/Images/default.png" />
                                <asp:FileUpload ID="upAnhDaiDien" runat="server" CssClass="hide" />
                            </div>
                        </div>

                        <div class="control-group">
                            <label class="control-label">Loại tin tức: </label>
                            <div class="controls">
                                <asp:DropDownList ID="ddLoaiTinTuc" runat="server"></asp:DropDownList>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator7"
                                    ToolTip="Bạn chưa chọn loại tin tức" ForeColor="Red" Font-Bold="true" ControlToValidate="ddLoaiTinTuc"
                                    runat="server" ErrorMessage="(*)" ValidationGroup="tm" InitialValue="-1"></asp:RequiredFieldValidator>
                            </div>
                        </div>

                        <div class="control-group">
                            <label class="control-label">Chi tiết: </label>
                            <div class="controls">
                                <asp:TextBox ID="txtChiTiet" runat="server" class="mceAdvanced"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ValidationExpression="^[\s\S]{0,3}$"
                                    ToolTip="Bạn chưa nhập nội dung" ForeColor="Red" Font-Bold="true" ControlToValidate="txtChiTiet"
                                    runat="server" ErrorMessage="(*)" ValidationGroup="tm"></asp:RequiredFieldValidator>
                            </div>
                        </div>

                    </div>
                </div>
                <div class="fg-toolbar ui-toolbar ui-widget-header ui-corner-bl">
                    <asp:Button ID="btThemMoi" runat="server" Text="Thêm mới" CssClass="btn btn-info"
                        OnClick="btThemMoi_Click" ValidationGroup="tm" />
                    <asp:Button ID="btLuu" runat="server" Text="Sửa" CssClass="btn btn-info" OnClick="btSua_Click"
                        ValidationGroup="tm" />
                    <asp:Button ID="btHuy" runat="server" Text="Hủy" CssClass="btn btn-info" OnClick="btHuy_Click" />
                    <%--<asp:Button ID="btXemTruoc" runat="server" Text="Xem trước" CssClass="btn btn-info" OnClick="btXemTruoc_Click" />--%>
                </div>
            </div>
        </div>
    </div>
</div>


<script src="../../js/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {

        tfm_path = '../Admin/TinyFileManager.NET';

        tinymce.init({
            selector: ".mceAdvanced",
            theme: "modern",
            mode: "specific_textareas",
            convert_urls: false,
            encoding: "xml",
            language: 'vi_VN',
            font_formats: "Times New Roman=times new roman ,Arial=arial,helvetica,sans-serif;",
            fontsize_formats: "8pt 9pt 10pt 11pt 12pt 13pt 14pt 16pt 26pt 36pt",
            plugins: [
             "advlist autolink lists link image charmap print preview hr anchor pagebreak",
             "searchreplace wordcount visualblocks visualchars code fullscreen",
             "insertdatetime media nonbreaking save table contextmenu directionality",
             "emoticons template paste textcolor tinyfilemanager.net"
            ],
            height: 500,
            toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent",
            toolbar2: "link image media | print preview | forecolor backcolor emoticons | fontselect fontsizeselect",
            // image_advtab: true,           
        });
    });



    function OpenUpload(fileUpload) {
        $(fileUpload).click();
    }

    $('#<%= anhDaiDien.ClientID %>').click(function () {
        $('#<%= upAnhDaiDien.ClientID%>').click();
    });
    $('#<%= upAnhDaiDien.ClientID%>').change(function () {
        readURL(this, '#<%= anhDaiDien.ClientID %>');
    });
    function readURL(input, imgAnhDaiDien) {

        if (input.files && input.files[0]) {
            var reader = new FileReader();
            reader.onload = function (e) {
                $(imgAnhDaiDien).attr('src', e.target.result);
            }
            reader.readAsDataURL(input.files[0]);
        }
    }

    $('#<%= btHuy.ClientID%>').click(function () {
        $('input:not([type=submit])').val('');
        $('textarea').val('');
        $('#ctl01_txtChiTiet_ifr body').html('');
    });
</script>
